Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2021 tax rate fixes and tests #974

Merged
merged 4 commits into from
Mar 6, 2022
Merged

2021 tax rate fixes and tests #974

merged 4 commits into from
Mar 6, 2022

Conversation

ssigwart
Copy link
Contributor

@ssigwart ssigwart commented Mar 6, 2022

  • Fixes taxes for under $100,000.
  • Adds tests to confirm amounts.

See https://www.irs.gov/instructions/i1040gi#idm140354391131776

What kind of change does this PR introduce? (delete not applicable)

  • Bugfix

- Fixes taxes for under $100,000
- Adds tests to confirm amounts
@codecov
Copy link

codecov bot commented Mar 6, 2022

Codecov Report

Merging #974 (7bd83dd) into master (c14b18e) will decrease coverage by 0.42%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #974      +/-   ##
==========================================
- Coverage   51.71%   51.29%   -0.43%     
==========================================
  Files         222      222              
  Lines       10213    10227      +14     
  Branches     1428     1432       +4     
==========================================
- Hits         5282     5246      -36     
- Misses       4916     4966      +50     
  Partials       15       15              
Impacted Files Coverage Δ
src/forms/Y2021/data/federal.ts 100.00% <100.00%> (ø)
src/forms/Y2021/irsForms/TaxTable.ts 96.66% <100.00%> (+2.91%) ⬆️
...orms/Y2020/irsForms/worksheets/Pub596Worksheet1.ts 44.44% <0.00%> (-53.34%) ⬇️
src/forms/Y2020/irsForms/ScheduleEIC.ts 42.45% <0.00%> (-35.20%) ⬇️
src/core/util.ts 67.90% <0.00%> (-12.35%) ⬇️
src/forms/Y2021/irsForms/F6251.ts 85.96% <0.00%> (+0.29%) ⬆️
src/components/TaxPayer/SpouseAndDependent.tsx 94.04% <0.00%> (+1.19%) ⬆️
src/forms/Y2021/irsForms/F8889.ts 97.36% <0.00%> (+27.19%) ⬆️
src/data/csvImport.ts 77.27% <0.00%> (+63.63%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update ff81d50...7bd83dd. Read the comment docs.

expect(CURRENT_YEAR).toEqual(2021)
})
it('ordinary taxes for single status should be correct', async () => {
expect(Math.round(computeOrdinaryTax(FilingStatus.S, 5))).toEqual(1)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could be handled a bit better I think, no reason you can't just have a CSV file loaded, loop over it and assert f(x) = y for each row in the file for example, or even doing a .foreach just on a JS array loaded above here would be fine.

Copy link
Collaborator

@zakpatterson zakpatterson Mar 6, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's also a property based testing approach that could work. You could have the tax table you linked imported directly as a CSV, and then generate arbitrary incomes, and assert for known income (I_0, I_1] and tax T, and test income I_0 < x <= I_1, T_0 < f(x) <= T_1.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I updated it to pull in a CSV, then a few points in every tax table range.

Copy link
Collaborator

@thegrims thegrims left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM! Thanks for fixing this

@thegrims thegrims merged commit bcbc97f into ustaxes:master Mar 6, 2022
@ssigwart ssigwart deleted the taxRates branch March 7, 2022 02:06
@tmm1
Copy link
Contributor

tmm1 commented Mar 10, 2022

See https://www.irs.gov/instructions/i1040gi#idm140354391131776

how did you convert this to csv?

@ssigwart
Copy link
Contributor Author

See https://www.irs.gov/instructions/i1040gi#idm140354391131776

how did you convert this to csv?

If I remember correctly, I copied it into VS Code, then converted all the tabs to commas and used some regex searches to remove unnecessary lines.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants